CREATE TABLE [dbo].[TASALD_FLEF]
(
[CO_EMPR] [dbo].[TD_VC_002] NOT NULL,
[NU_CNTB_EMPR] [dbo].[TD_IN_001_CONT] NOT NULL,
[NU_ANNO] [dbo].[TD_IN_004_ANNO] NOT NULL CONSTRAINT [DF__TASALD_FL__NU_AN__29572725] DEFAULT (datepart(year,getdate())),
[NU_MESE] [dbo].[TD_IN_002_MESE] NOT NULL,
[CO_CNTA_FLEF] [dbo].[TD_VC_010] NOT NULL,
[IM_TOTA_CARG] [dbo].[TD_NU_016_004] NOT NULL CONSTRAINT [DF__TASALD_FL__IM_TO__2C3393D0] DEFAULT ((0)),
[IM_TOTA_ABON] [dbo].[TD_NU_016_004] NOT NULL CONSTRAINT [DF__TASALD_FL__IM_TO__2E1BDC42] DEFAULT ((0)),
[PR_DATO] [dbo].[TD_VC_020] NULL,
[CO_USUA_CREA] [dbo].[TD_VC_008_USUA] NOT NULL,
[FE_USUA_CREA] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TASALD_FL__FE_US__300424B4] DEFAULT (getdate()),
[CO_USUA_MODI] [dbo].[TD_VC_008_USUA] NOT NULL,
[FE_USUA_MODI] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TASALD_FL__FE_US__30F848ED] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TASALD_FLEF] ADD CONSTRAINT [CK__TASALD_FL__IM_TO__2D27B809] CHECK (([IM_TOTA_CARG]>=(0)))
GO
ALTER TABLE [dbo].[TASALD_FLEF] ADD CONSTRAINT [CK__TASALD_FL__IM_TO__2F10007B] CHECK (([IM_TOTA_ABON]>=(0)))
GO
ALTER TABLE [dbo].[TASALD_FLEF] ADD CONSTRAINT [CK__TASALD_FL__NU_AN__2A4B4B5E] CHECK (([NU_ANNO]>=(0)))
GO
ALTER TABLE [dbo].[TASALD_FLEF] ADD CONSTRAINT [CK__TASALD_FL__NU_CN__286302EC] CHECK (([NU_CNTB_EMPR]>=(1) AND [NU_CNTB_EMPR]<=(99)))
GO
ALTER TABLE [dbo].[TASALD_FLEF] ADD CONSTRAINT [CK__TASALD_FL__NU_ME__2B3F6F97] CHECK (([NU_MESE]>=(0) AND [NU_MESE]<=(13)))
GO
ALTER TABLE [dbo].[TASALD_FLEF] ADD CONSTRAINT [TASALD_CNT_14386281683] PRIMARY KEY CLUSTERED  ([CO_EMPR], [NU_CNTB_EMPR], [NU_ANNO], [NU_MESE], [CO_CNTA_FLEF]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [ITASALD_FLEF_01] ON [dbo].[TASALD_FLEF] ([NU_CNTB_EMPR]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TASALD_FLEF] ADD CONSTRAINT [PK1_TMPLAN_FLEF_A_TASALD_FLEF] FOREIGN KEY ([CO_EMPR], [CO_CNTA_FLEF]) REFERENCES [dbo].[TMPLAN_FLEF] ([CO_EMPR], [CO_CNTA_FLEF])
GO
ALTER TABLE [dbo].[TASALD_FLEF] ADD CONSTRAINT [FK1_TTCNTB_EMPR_A_TASALD_FLEF] FOREIGN KEY ([CO_EMPR], [NU_CNTB_EMPR]) REFERENCES [dbo].[TTCNTB_EMPR] ([CO_EMPR], [NU_CNTB_EMPR])
GO
